package com.zw.yzk.kabu.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhanwei on 2017/3/16.
 */

public class WechatPayInfo {
    public static final int PAYMENT_TYPE_TICKET = 1;
    public static final int PAYMENT_TYPE_GOODS = 2;

    private static WechatPayInfo instance;

    /**
     * 支付类型，1：门票，2：商品，当微信支付成功后会根据相应的类型跳转对应的页面
     */
    private int paymentType;

    /**
     * 交易号
     */
    private String tradeId;

    /**
     * 订单号
     */
    private List<String> orderIdList;


    private WechatPayInfo() {
    }

    public static WechatPayInfo getInstance() {
        if (instance == null) {
            synchronized (WechatPayInfo.class) {
                instance = new WechatPayInfo();
            }
        }
        return instance;
    }

    public void setTradeInfo(int paymentType, String tradeId) {
        this.paymentType = paymentType;
        this.tradeId = tradeId;
    }

    public int getPaymentType() {
        return this.paymentType;
    }

    public String getTradeId() {
        return tradeId;
    }

    public void setOrderId(String orderId) {
        if (orderIdList == null) {
            orderIdList = new ArrayList<>();
        } else {
            orderIdList.clear();
        }
        orderIdList.add(orderId);
    }

    public void setOrderIdList(List<String> list) {
        if (orderIdList == null) {
            orderIdList = new ArrayList<>();
        } else {
            orderIdList.clear();
        }
        orderIdList.addAll(list);
    }

    public List<String> getOrderIdList() {
        return this.orderIdList;
    }
}
